﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Primitives;

namespace Smart_Archives.Utils
{
    /// <summary>
    /// string类型拓展
    /// </summary>
    public static class StringExtention
    {
        public static int ToInt(this string str, int defaultValue = 0)
        {
            int result;
            return int.TryParse(str, out result) ? result : defaultValue;
        }
        public static int ToInt(this StringValues str, int defaultValue = 0)
        {
            int result;
            return int.TryParse(str, out result) ? result : defaultValue;
        }
       
    }
}
